import java.io.*;
import java.net.*;

public class ClientTCP {
	public static void main(String argv[]) throws Exception
	{
		String sentence="";
		String phraseModifiee;
		
		BufferedReader entreeDepuisUtilisateur = new BufferedReader(new InputStreamReader(System.in));
		
		while(!(sentence.equals("END") || sentence.equals("END SERVEUR"))){
			System.out.println("Connexion en cours\n");	
		
		//Socket socketClient = new Socket(argv[0], 30546);
		//Socket socketClient = new Socket("192.168.1.4", 30546);
		Socket socketClient = new Socket("192.168.1.4", 30456);
		System.out.println("entrez une phrase!!\n");
		DataOutputStream sortieVersServeur = new DataOutputStream(socketClient.getOutputStream());
		
		BufferedReader entreeDepuisServeur = new BufferedReader(new	InputStreamReader(socketClient.getInputStream()));
		
		sentence = entreeDepuisUtilisateur.readLine();
		
		sortieVersServeur.writeBytes(sentence + '\n');
		
		phraseModifiee = entreeDepuisServeur.readLine();
		
		System.out.println("RECU DU SERVEUR: " + phraseModifiee +"\n");
		
		sentence=phraseModifiee;
		
		socketClient.close();
		}
		
	}

}
